<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta charset="utf-8">
		<title>驴妈妈竞品分析系统</title>
		<meta name="description" content="overview &amp; stats">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="${request.contextPath}/static/assets/css/loading-incr.css" />
		<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.css">
		<link rel="stylesheet" href="${request.contextPath}/static/assets/font-awesome/4.5.0/css/font-awesome.min.css">
		<!-- page specific plugin styles -->
	
		<!-- text fonts -->
		<link rel="stylesheet" href="${request.contextPath}/static/assets/css/fonts.css">
		<!-- ace styles -->
		<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style">
	
		<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap-datepicker3.min.css">
		<style type="text/css">
		#deleteRemind{
				width:300px
			}
		</style>
	</head>

	<body class="skin-2" style="background-color: #FFF;" id="loadingdiv">
		<div class="page-content">
			<div class="row">
				<div class="col-sm-12">
					<div class="row">
					<div class="col-xs-12">
								<div class="widget-box">
									<div class="widget-body" style="background-color: #EFF3F8;">
										<div class="widget-main">											
											<form class="form-inline" id="searchForm" method="post" action="${request.contextPath}/background/priceSafety">
											<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<div class="form-group" style="width: 100%;">
													<label  for="exampleInputName">级别
														<select name="level_type" id="level_type" aria-controls="dynamic-table" class="form-control input-sm">
																		<option  value="Normal"  <#if level_type?? && level_type=="Normal">selected</#if>>一般级别</option>
																		 <option  value="Super"  <#if level_type?? && level_type=="Super">selected</#if>>特殊级别</option>
														</select>
													</label>
													<label  for="exampleInputName" style="margin-left: 30px;">业务类型
														<select name="busi_type" id="businessCodeSearch" aria-controls="dynamic-table" class="form-control input-sm" style="width:80px;height:34px">
															  <option value="" <#if busi_type??&&busi_type=="">selected</#if>>全部</option>
														      <#if busi_type??&&busi_type=="TICKET"><option value="TICKET" selected>门票</option><#else><option value="TICKET">门票</option></#if>
														      <#if busi_type??&&busi_type=="HOTEL"><option value="HOTEL" selected>酒店</option><#else><option value="HOTEL">酒店</option></#if>
														</select>
													</label>
													<button type="submit" class="btn btn-pink btn-sm" id="search"  style="margin-left: 30px;">
														<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>查询
													</button>
													<label style="float: right;padding-right: 10px;cursor: pointer;">
														<span class="label label-lg label-success arrowed-right"  id="syschronization" onclick="syschronization(this);">同步</span>
														<span class="label label-lg label-purple arrowed" data-toggle="modal" data-target="#newLevelModal" onclick="newSuperLevel();">新增</span>
														<!--<a href="#" onclick="newSuperLevel();" role="button" data-target="#superModal" data-toggle="modal"><span class="label label-lg label-purple arrowed" data-toggle="modal" data-target="#myModalInput" onclick="newSuperLevel();">新增</span></a>
														 <div class="col-xs-3 col-sm-10" align='right'>
															<div class="dataTables_length">
																<a class="green" href="#" onclick="newSuperLevel();" role="button" data-target="#superModal" data-toggle="modal">
																<button type="button" class="btn btn-pink btn-sm" id="search">
																	<span class="ace-icon fa icon-on-right bigger-110"></span>
																	新增
																</button>
																</a>
															</div>
														</div> -->
													</label>
												</div>
											</form>	
											
											<form action="${request.contextPath}/backConfig/export" id="exportForm" method="post" hidden="true">
												<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<input id="productIdExport" name="productId" type="text" hidden="true">
												<input id="productNameExport" name="productName" type="text" hidden="true">
												<input id="cityNameExport" name="cityName" type="text" hidden="true">
												<input id="businessCodeExport" name=businessCode type="text" hidden="true">
												<button type="submit" hidden="true" id="exportExcel" class="btn btn-primary" ></button>
											</form>
										</div>
									</div>
								</div>
							</div>
						<div class="col-xs-12">
							<div class="clearfix"></div>
							<div class="tab-pane in active" id="codeList">
								<div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
								
									<!--  <div class="col-xs-2">
												<div class="dataTables_length">
													<label><strong>一般级别</strong></label>
												</div>
									</div>-->
									<!-- 一般级别展示列表 -->
									<#if level_type?? && level_type=="Normal">
									<table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="dynamic-table_info">
										<tr>
											<th>No.</th>
											<th>业务类型</th>
											<th>数据校验跨度</th>
											<th>上浮度</th>
											<th>下浮度</th>
											<th>是否开启</th>
											<th>更新</th>
										</tr>
										<tbody>
										<#if normalLevels??&&normalLevels?size&gt;0>
										<#list normalLevels as normal>
												<tr id="n_<#if normal.id??>${normal.id}</#if>">
												    <td>${normal_index + 1}</td>
												    <td class="business_type" id="busi_<#if normal.business_type??>${normal.business_type}</#if>">
													    <#if normal.business_type??>
													    <#if normal.business_type=="HOTEL">酒店</#if>
													    <#if normal.business_type=="TICKET">门票</#if>
													    </#if>
													  </td>
													<!--<td class="rule_level" id="n_<#if normal.rule_level??>${normal.rule_level}</#if>">
														<#if normal.remark??>${normal.remark}</#if>
													</td> -->
													 <td class="rule_level" id="rule_<#if normal.rule_level??>${normal.rule_level}</#if>">
													<#if normal.rule_level??>
												    <#if normal.rule_level==1>周内级别</#if>
												    <#if normal.rule_level==2>月度级别</#if>
												    <#if normal.rule_level==3>季度级别</#if>
												    <#if normal.rule_level==4>年度级别</#if>
												    </#if>
													</td>
													<td class="left_value"><#if normal.left_value??>${normal.left_value}</#if></td>
													<td class="right_value"><#if normal.right_value??>${normal.right_value}</#if></td>
													<td class="is_open"><#if normal.is_open??><#if normal.is_open==0>未开启<#else>已开启</#if></#if></td>
													<td>
														<div class="hidden-sm hidden-xs action-buttons" >
															<a class="green" role="button" onclick="updateLevel(this);"data-toggle="modal" data-target="#myModal">
																<i class="ace-icon fa fa-pencil bigger-130"></i>
															</a>
															<a class="red" onclick="deleteSuperLink(this);">
																<i class="ace-icon fa fa-trash-o bigger-130"></i>
															</a>
														</div>
													</td>
												</tr>
										</#list>
										</#if>
										</tbody>
									</table>
									</#if>
									<!-- </br>
									<div class="col-xs-2">
											<div class="dataTables_length">
												<label><strong>特殊级别</strong></label>
											</div>
									</div> 
									<div class="col-xs-3 col-sm-10" align='right'>
											<div class="dataTables_length">
												<a class="green" href="#" onclick="newSuperLevel();" role="button" data-target="#superModal" data-toggle="modal">
												<button type="button" class="btn btn-pink btn-sm" id="search">
													<span class="ace-icon fa icon-on-right bigger-110"></span>
													新增
												</button>
												</a>
											</div>
									</div>-->
									<!-- 特殊级别展示列表 -->
									<#if level_type?? && level_type=="Super">
									<table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" aria-describedby="dynamic-table_info">
											<tr>
												<th>业务类型</th>
												<th>数据校验跨度</th>
												<th>上浮度</th>												
												<th>下浮度</th>
												<th>起始日期</th>
												<th>结束日期</th>
												<th>描述</th>
												<th>是否开启</th>
												<th>操作</th>
											</tr>
										<tbody>
										<#if superLevels??&&superLevels?size&gt;0>
										<#list superLevels as super>
												<tr id="s_<#if super.id??>${super.id}</#if>">
													<td class="s_business_type" id="busi_<#if super.business_type??>${super.business_type}</#if>">
													    <#if super.business_type??>
													    <#if super.business_type=="HOTEL">酒店</#if>
													    <#if super.business_type=="TICKET">门票</#if>
													    </#if>
													 </td>
												    <td class="s_rule_level" id="rule_<#if super.rule_level??>${super.rule_level}</#if>"><#if super.rule_level??>
												    <#if super.rule_level==1>周内级别</#if>
												    <#if super.rule_level==2>月度级别</#if>
												    <#if super.rule_level==3>季度级别</#if>
												    <#if super.rule_level==4>年度级别</#if>
												    </#if>
													</td>
													<td class="s_left_value"><#if super.left_value??>${super.left_value}</#if></td>
													<td class="s_right_value"><#if super.right_value??>${super.right_value}</#if></td>
													<td class="s_start_date"><#if super.start_date??>${super.start_date?string('yyyy-MM-dd')}</#if>													    
														<!-- <input type="text"class="form-control" id="dateTime" name="dateTime" placeholder="日期">	 -->																												          
													</td>
													<td class="s_end_date"><#if super.end_date??>${super.end_date?string('yyyy-MM-dd')}</#if>												    
														<!-- <input type="text"class="form-control" id="dateTime" name="dateTime" placeholder="日期">	 -->																												          
													</td>
													<td class="s_remark"><#if super.remark??>${super.remark}</#if></td>
													<td class="s_is_open"><#if super.is_open??><#if super.is_open==0>未开启<#else>已开启</#if></#if>
													<!-- 
														<label class="pos-rel">
															<input type="checkbox" class="ace">
															<span class="lbl"></span>
														</label> -->
													</td>
													<td>
														<div class="hidden-sm hidden-xs action-buttons" align="right">
															<a class="green" role="button" data-target="#superModal" data-toggle="modal" onclick="updateSuperLevel(this);">
																<i class="ace-icon fa fa-pencil bigger-130"></i>
															</a>
															<a class="red" onclick="deleteSuperLink(this);">
																<i class="ace-icon fa fa-trash-o bigger-130"></i>
															</a>
														</div>
													</td>
												</tr>
											</#list>
											</#if>
										</tbody>
									</table>
									</#if>
								</div>	
							</div>			
						</div>	
						<!-- 一般级别修改弹框 -->
						<div class="row">
							<div class="col-xs-12">
								<button class="btn btn-info"  type="button"
									style="display: none;" id="update" >
								</button>
								<form id="updateLevel" class="form-horizontal" role="form"
									 method="post">
									<input type="hidden" id="_csrf" name="${_csrf.parameterName}"
									value="${_csrf.token}" />
									<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
										aria-labelledby="myModalLabel" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal"
														aria-hidden="true">×</button>
													<h4 class="modal-title" id="myModalLabel">一般级别</h4>
												</div>
												<div class="modal-body">
													<input id="id" name="id" value="" type="hidden">
		
													<div class="space-4"></div>
													<div class="form-group">
														<div class="col-sm-9">	
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 数据校验跨度</label>
																<div class="col-sm-9">
																	<select id="s_rule_level" name="rule_level" aria-controls="dynamic-table" class="form-control input-sm">
																		<option value="4">年度级别</option>
																		<option value="3">季度级别</option>
																		<option value="2">月度级别</option>
																		<option value="1">周度级别</option>
																	</select>
																</div>
															</div>										 
														     <div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">上浮度</label>
																<div class="col-sm-9">
																	<input type="text" id="left_value" name="left_value"
																		placeholder="上浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">下浮度</label>
								
																<div class="col-sm-9">
																	<input type="text" id="right_value" name="right_value"
																		placeholder="下浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">是否开启</label>		
																<div class="col-sm-9">
																  <select name="is_open" id="is_open" aria-controls="dynamic-table" class="form-control input-sm">
																		<option  value="0" >关闭</option>
																		 <option  value="1">开启</option>
																  </select>
																</div>
															</div>
														 
															
														</div>
													</div>
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-pink btn-sm"
														data-dismiss="modal">关闭</button>
													<button type="submit" class="btn btn-pink btn-sm" id="save">
														提交</button>
												</div>
											</div>
											<!-- /.modal-content -->
										</div>
										<!-- /.modal -->
									</div>
								</form>
							</div>
						</div>
						<!-- 特殊级别 -->
						<div class="row">
							<div class="col-xs-12">
								<form id="updateSuperLevel" class="form-horizontal" role="form"
									 method="post">
									<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
									<div class="modal fade" id="superModal" tabindex="-1" role="dialog"
										aria-labelledby="superModalLabel" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal"
														aria-hidden="true">×</button>
													<h4 class="modal-title" id="myModalLabel">特殊级别</h4>
												</div>
												<div class="modal-body">
													 <input id="s_id" name="id" value="" type="hidden"> 
													 <input id="s_level_type" name="level_type" value="Super" type="hidden"> 
													<div class="space-4"></div>
													<div class="form-group">
														<div class="col-sm-10">	
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 业务类型</label>
																<div class="col-sm-7">
																	<select id="s_busi_type" name="busi_type" aria-controls="dynamic-table" class="form-control input-sm">
																		<option value="HOTEL">酒店</option>
																		<option value="TICKET">门票</option>
																	</select>
																</div>
															</div>										 
														    <div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 数据校验跨度</label>
																<div class="col-sm-7">
																	<select id="s_rule_level" name="rule_level" aria-controls="dynamic-table" class="form-control input-sm">
																		<option value="4">年度级别</option>
																		<option value="3">季度级别</option>
																		<option value="2">月度级别</option>
																		<option value="1">周度级别</option>
																	</select>
																</div>
															</div>
														    <div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">上浮度</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_left_value" name="left_value"
																		placeholder="上浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">下浮度</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_right_value" name="right_value"
																		placeholder="下浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">起始日期</label>
		
																<div class="col-sm-7">
																	<input type="text"class="form-control" id="s_start_date" name="start_date" placeholder="起始日期">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">结束日期</label>
		
																<div class="col-sm-7">
																	<input type="text"class="form-control" id="s_end_date" name="end_date" placeholder="结束日期">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">描述</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_remark" name="remark"
																		placeholder="描述" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">是否开启</label>		
																<div class="col-sm-7">
		                                                          <select name="is_open" id="s_is_open" aria-controls="dynamic-table" class="form-control input-sm">
																	    <option  value="0" >关闭</option>
																	     <option  value="1">开启</option>
																  </select>
																</div>
															</div>
															
														</div>
													</div>
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-pink btn-sm"
														data-dismiss="modal">关闭</button>
													<button type="submit" class="btn btn-pink btn-sm" id="submitSuper">
														提交</button>
												</div>
											</div>
											<!-- /.modal-content -->
										</div>
										<!-- /.modal -->
									</div>
								</form>
							</div>
						</div>
						<!-- 一般级别和特殊级别新增 -->
						<div class="row">
							<div class="col-xs-12">
								<form id="newLevel" class="form-horizontal" role="form"
									 method="post"  onsubmit="return validate_form(this)" >
									<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
									<div class="modal fade" id="newLevelModal" tabindex="-1" role="dialog"
										aria-labelledby="superModalLabel" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal"
														aria-hidden="true">×</button>
													<h4 class="modal-title" id="myModalLabel">校验数据新增</h4>
												</div>
												<div class="modal-body">
													 <input id="s_id_new" name="id" value="" type="hidden">
		
													<div class="space-4"></div>
													<div class="form-group">
														<div class="col-sm-10">	
															<div class="form-group"  id="tips"></div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 级别类型</label>
																<div class="col-sm-7">
																	<select name="level_type" id="s_level_type_new" aria-controls="dynamic-table" class="form-control input-sm">
																				<option  value="Normal"  selected>一般级别</option>
																				<option  value="Super" >特殊级别</option>
																	</select>
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 业务类型</label>
																<div class="col-sm-7">
																	<select id="s_busi_type_new" name="busi_type" aria-controls="dynamic-table" class="form-control input-sm">
																		<option value="HOTEL">酒店</option>
																		<option value="TICKET">门票</option>
																	</select>
																</div>
															</div>										 
														    <div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1"> 数据校验跨度</label>
																<div class="col-sm-7">
																	<select id="s_rule_level_new" name="rule_level" aria-controls="dynamic-table" class="form-control input-sm">
																		<option value="4">年度级别</option>
																		<option value="3">季度级别</option>
																		<option value="2">月度级别</option>
																		<option value="1">周度级别</option>
																	</select>
																</div>
															</div>
														    <div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">上浮度</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_left_value_new" name="left_value"
																		placeholder="上浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">下浮度</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_right_value_new" name="right_value"
																		placeholder="下浮度" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">起始日期</label>
		
																<div class="col-sm-7">
																	<input type="text"class="form-control" id="s_start_date_new" name="start_date" placeholder="起始日期">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">结束日期</label>
		
																<div class="col-sm-7">
																	<input type="text"class="form-control" id="s_end_date_new" name="end_date" placeholder="结束日期">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">描述</label>
		
																<div class="col-sm-7">
																	<input type="text" id="s_remark_new" name="remark"
																		placeholder="描述" class="form-control">
																</div>
															</div>
															<div class="form-group">
																<label class="col-sm-3 control-label no-padding-right"
																	for="form-field-1">是否开启</label>		
																<div class="col-sm-7">
		                                                          <select name="is_open" id="s_is_open_new" aria-controls="dynamic-table" class="form-control input-sm">
																	    <option  value="0" >关闭</option>
																	     <option  value="1">开启</option>
																  </select>
																</div>
															</div>
															
														</div>
													</div>
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-pink btn-sm"
														data-dismiss="modal">关闭</button>
													<button type="submit" class="btn btn-pink btn-sm" id="submitSuper_new">
														提交</button>
												</div>
											</div>
											<!-- /.modal-content -->
										</div>
										<!-- /.modal -->
									</div>
								</form>
							</div>
						</div>
							<!-- 删除提醒 -->
						<button class="btn btn-info" data-toggle="modal" type="button" style="display:none;" id="deleteForm" data-target="#deleteModal">
								</button>
						<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
						<input type="hidden" id="deleteId" name="deleteId"/>
						<div class="modal-dialog link" id="deleteRemind">
							<div class="modal-content">
								<div class="modal-header" style="height:20px">
						            <button type="button" class="close" data-dismiss="modal" aria-hidden="true" id='close1' style="height:10px;line-height:5px">
						                  <small>×</small>
						            </button>
					         	</div>
					         	<div class="modal-body">
					         			 <strong style="padding-left:70px">是否确认删除？</strong>
					         	</div>
					         	<div class="modal-footer" style="height:50px">
					         		<button type="button" class="btn btn-default" data-dismiss="modal" style="height:30px;line-height:10px">
								    	取消
								    </button>
					         		<button type="button" class="btn btn-primary" data-dismiss="modal" style="height:30px;line-height:10px" id="confirmDelete">
						              	 确定
						            </button>
					         	</div>
							</div>
						</div>
						</div>
						
					</div>					
				</div>
			</div>
		</div>
		<input type="hidden" id="priceSafetycontext" value="${request.contextPath}"/>
		<script src="${request.contextPath}/static/assets/js/jquery-2.1.4.min.js"></script>
		<script src="${request.contextPath}/static/assets/js/bootstrap.min.js"></script>
		<!-- ace scripts -->	
		<script src="${request.contextPath}/static/assets/js/bootbox.js"></script>
		<script src="${request.contextPath}/static/assets/js/ace-elements.min.js"></script>
		<script src="${request.contextPath}/static/assets/js/ace.min.js"></script>
		<!-- user scripts -->
		<script src="${request.contextPath}/static/assets/js/moment.min.js"></script>
		<script src="${request.contextPath}/static/assets/js/bootstrap-datepicker.min.js"></script>
		<script type="text/javascript" src="${request.contextPath}/static/javascripts/loading-incr.js"></script>
		<script type="text/javascript">
		var priceSafetycontext = $("#priceSafetycontext").val();
			jQuery(function($) {
				$("input[name=start_date]").datepicker({
					format : "yyyy-mm-dd",
					autoclose : true
				});
				$("input[name=end_date]").datepicker({
					format : "yyyy-mm-dd",
					autoclose : true
				});
			})
			updateLevel=function(obj){
				id=$(obj).parents("tr").attr("id").split("_")[1];
				rule_level=$(obj).parents("tr").find(".rule_level").attr("id").split("_")[1];
				left_value=$(obj).parents("tr").find(".left_value").text();
				right_value=$(obj).parents("tr").find(".right_value").text();
				is_open=$(obj).parents("tr").find(".is_open").text();
				if(is_open=="已开启"){
					$("#is_open").val("1");
				}else{
					$("#is_open").val("0");
				}
				$("#id").val(id);
				$("#rule_level").val(rule_level);
				$("#left_value").val(left_value);
				$("#right_value").val(right_value);
				//异步提交到后台
				/*$.ajax({
					url : priceSafetycontext+'/background/updateSuperLevel',
					type : "GET",
					data : {
						id:$("#id").val(),
						left_value:$("#left_value").val(),
						rule_level:$("#rule_level").val(),
						right_value:$("#right_value").val(),
						level_type:"Normal",
						is_open:$("#is_open").val()
					},
					success:function(data){
						if(data.sessionStatus==540){//异步请求session过期状态
							window.location.href=priceSafetycontext+"/login";
							return;
						}
					}
				});*/
				
				
			};
			updateSuperLevel=function(obj){
				
				id=$(obj).parents("tr").attr("id").split("_")[1];
				busi_type=$(obj).parents("tr").find(".s_business_type").attr("id").split("_")[1];
				rule_level=$(obj).parents("tr").find(".s_rule_level").attr("id").split("_")[1];
				left_value=$(obj).parents("tr").find(".s_left_value").text();
				right_value=$(obj).parents("tr").find(".s_right_value").text();
				start_date=$(obj).parents("tr").find(".s_start_date").text();
				end_date=$(obj).parents("tr").find(".s_end_date").text();
				remark=$(obj).parents("tr").find(".s_remark").text();
				is_open=$(obj).parents("tr").find(".s_is_open").text().trim();
				$("#s_id").val(id);
				$("#s_busi_type").val(busi_type);
				$("#s_rule_level").val(rule_level);
				$("#s_left_value").val(left_value);
				$("#s_right_value").val(right_value);
				$("#s_start_date").val(start_date);
				$("#s_end_date").val(end_date);
				$("#s_remark").val(remark);
				if(is_open=="已开启"){
					$("#s_is_open").val("1");
				}else{
					$("#s_is_open").val("0");
				}
				if($("#s_remark").val().trim().length>0&&$("#s_rule_level").val().trim().length>0){
					//异步提交到后台
					/*$.ajax({
						url : priceSafetycontext+'/background/updateSuperLevel',
						type : "GET",
						data : {
							id:$("#s_id").val(),
							left_value:$("#s_left_value").val(),
							right_value:$("#s_right_value").val(),
							rule_level:$("#s_rule_level").val(),
							start_date:$("#s_start_date").val(),
							end_date:$("#s_end_date").val(),
							is_open:$("#s_is_open").val(),
							remark:$("#s_remark").val()
						},
						success:function(data){
							if(data.sessionStatus==540){//异步请求session过期状态
								window.location.href=priceSafetycontext+"/login";
								return;
							}
						}
					});*/
				}else{
					$("#s_rule_level").parent().parent().find("div.remind").remove();
					$("#s_rule_level").parent().parent().append("<div style='color:red' class='remind'>级别不能为空！</div>");
					$("#s_remark").parent().parent().find("div.remind").remove();
					$("#s_remark").parent().parent().append("<div style='color:red' class='remind'>描述不能为空！</div>");
				}
				
				
			};
			
			newSuperLevel=function(){
				$("#s_id_new").val("");
				
				$("#s_rule_level_new").val("").parent().parent().find("div.remind").remove();
				$("#s_rule_level_new").val("").parent().parent().append("<div style='color:red' class='remind'>*</div>");
				
				$("#s_left_value_new").val("0.5");
				$("#s_right_value_new").val("0.5");
				
				$("#s_start_date_new").val("").parent().parent().find("div.remind").remove();
				$("#s_start_date_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*一般级别不填</div>");
				
				$("#s_end_date_new").val("").parent().parent().find("div.remind").remove();
				$("#s_end_date_new").parent().parent().append("<div style='color:red;font-size:9px;marginheight:auto' class='remind'>*一般级别不填</div>");
				
				$("#s_remark_new").val("").parent().parent().find("div.remind").remove();
				$("#s_remark_new").val("").parent().parent().append("<div style='color:red;font-size:9px;marginheight:auto' class='remind'>*一般级别不填</div>");
				
				$("#s_is_open_new").val("0");
			}
			
			validate_form = function(){
				var id=$("#s_id_new").val();
				var busi_type=$("#s_busi_type_new").val();
				var rule_level=$("#s_rule_level_new").val();
				var left_value=$("#s_left_value_new").val();
				var level_type=$("#s_level_type_new").val();
				var right_value=$("#s_right_value_new").val();
				var start_date=$("#s_start_date_new").val();
				var end_date=$("#s_end_date_new").val();
				var remark=$("#s_remark_new").val();
				
				if(rule_level=="" || rule_level==null ){
					$("#s_rule_level_new").parent().parent().find("div.remind").remove();
					$("#s_rule_level_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*数据校验跨度不能为空</div>");
					return false;
				} 
				if(level_type=="Super"){
					if(left_value=="" || level_type==null){
						$("#s_left_value_new").parent().parent().find("div.remind").remove();
						$("#s_left_value_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*上浮度不能为空</div>");
						return false;
					}else{
						$("#s_left_value_new").parent().parent().find("div.remind").remove();
					}
					if(right_value=="" || right_value==null){
						$("#s_right_value_new").parent().parent().find("div.remind").remove();
						$("#s_right_value_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*下浮度不能为空</div>");
						return false;
					}else{
						$("#s_right_value_new").parent().parent().find("div.remind").remove();
					}
					if(start_date=="" || start_date==null){
						$("#s_start_date_new").parent().parent().find("div.remind").remove();
						$("#s_start_date_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*开始日期不能为空</div>");
						return false;
					}else{
						$("#s_start_date_new").parent().parent().find("div.remind").remove();
						$("#s_start_date_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*</div>");
					}
					if(end_date=="" || end_date==null){
						$("#s_end_date_new").parent().parent().find("div.remind").remove();
						$("#s_end_date_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*结束日期不能为空</div>");
						return false;
					}else{
						$("#s_end_date_new").parent().parent().find("div.remind").remove();
						$("#s_end_date_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*</div>");
					}
					if(remark=="" || remark==null){
						$("#s_remark_new").parent().parent().find("div.remind").remove();
						$("#s_remark_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*描述不能为空</div>");
						return false;
					}else{
						$("#s_remark_new").parent().parent().find("div.remind").remove();
						$("#s_remark_new").parent().parent().append("<div style='color:red; font-size:9px;marginheight:auto' class='remind'>*</div>");
					}
				}else{
					/*var flag=true;
					$.ajax({
						url: priceSafetycontext+ '/background/queryRuleLevelModel',
						type : "GET",
						data:{
							level_type:"Normal",
							business_type:busi_type,
							rule_level:rule_level
						},
						beforeSend:function(){
							$("#submitSuper_new").attr("disabled",true);
						},
						complete:function(){
							$("#submitSuper_new").attr("disabled",false);
						},
						success:function(data){
							//alert(data);
							if(data){
							    //alert(busi_type+"=========="+$("#s_rule_level_new").text()+"------------");
								//bootbox.alert("<strong style='padding-left:200px'>业务类型为:"+", 数据校验跨度为："+"的配置已存在！</strong>", function(){flag=false});
								flag=false;
							}else{
								flag= true;
							}
						},
						error:function(){
							flag= false;
						}
					});*/
					
					return true;
				}
				return true;
			}
			
			
			$("#submitSuper").click(function(){
				
				var i=0;
				if($("#s_remark").val()==null||$("#s_remark").val()==""||$("#s_remark").val().trim()==""){
					$("#s_remark").parent().parent().find("div.remind").remove();
					$("#s_remark").parent().parent().append("<div style='color:red' class='remind'>描述不能为空</div>");
					i+=1;
				}
				if($("#s_rule_level").val()==null||$("#s_rule_level").val()==""||$("#s_rule_level").val().trim()==""){
					$("#s_rule_level").parent().parent().find("div.remind").remove();
					$("#s_rule_level").parent().parent().append("<div style='color:red' class='remind'>级别不能为空</div>");
					i+=1;
				}
				if($("#s_start_date").val()==null||$("#s_start_date").val()==""||$("#s_start_date").val().trim()==""){
					$("#s_start_date").parent().parent().find("div.remind").remove();
					$("#s_start_date").parent().parent().append("<div style='color:red' class='remind'>起始时间不能为空</div>");
					i+=1;
				}
				if($("#s_end_date").val()==null||$("#s_end_date").val()==""||$("#s_end_date").val().trim()==""){
					$("#s_end_date").parent().parent().find("div.remind").remove();
					$("#s_end_date").parent().parent().append("<div style='color:red' class='remind'>结束时间不能为空</div>");
					i+=1;
				}
				if(i>0){
					return false;
				}
			});
			
			syschronization=function(obj){
				bootbox.confirm("<strong style='font-size:15px;padding-left:150px'>是否确认同步？</strong>", function(result){
					if(result){
				            if($(".fade")){
				                 $(".fade").css("display","none");
				                 openPartialLayer($("#loadingdiv"));
				                 setTimeout(function(){	
				        						$.ajax({
				        							url :priceSafetycontext+ '/background/reload/roleLevel',
				        							type : "GET",
				        							async: false,
				        							beforeSend: function () {
				                             			$(obj).attr("disabled", true);
				                         			},
							                        complete: function () {
							                             $(obj).attr("disabled", false);
							                             removeLoading($("#loadingdiv"));//移除遮罩层
							                         },
				        							success:function(data){
				        								if(data.Success!=null){
				        				                        bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){});
				        				                  } else{
				        				                  		bootbox.alert("<strong style='padding-left:200px'>"+data.Error+"</strong>",function(){});
				        				                  }
				        							},
				        							error:function(data){
				        								bootbox.alert("<strong style='padding-left:200px'>同步失败</strong>",function(){});
				        							}
				      						  });
				                 },50)
							}
					}
				});
				
			};
			
			deleteSuperLink=function(obj){
				sid=$(obj).parents("tr").attr("id");
				$("#deleteId").val(sid);
				$("#deleteForm").click();
				
				/*
				bootbox.confirm("<strong style='font-size:15px;padding-left:150px'>是否确认删除？</strong>", function(result){
					if(result){
						$.ajax({
							url : '/background/deleteSuperLevel',
							type : "GET",
							data : {
								id:id
							},
							success:function(data){
								$(obj).parents("tr").remove();
							}
						});
					}
				});*/
			};
			$("#confirmDelete").click(function(){
				sid=$("#deleteId").val();
				id=sid.split("_")[1];
				$.ajax({
					url : priceSafetycontext+'/background/deleteSuperLevel',
					type : "GET",
					data : {
						id:id
					},
					success:function(data){
						if(data.sessionStatus==540){//异步请求session过期状态
							window.location.href=priceSafetycontext+"/login";
							return;
						}
						$("#"+sid).remove();
					}
				});
			});
		</script>
		
	</body>
</html>